import request from '@utils/request'

// 查询道路缺陷记录列表
export function getDefectList(params) {
  return request({
    url: '/business/defect/list',
    method: 'get',
    headers: {
        isToken: false,
    },
    params: params
  });
}

// 道路缺陷记录详情
export function getDefectDetail(id: string) {
  return request({
    url: '/business/defect/' + id,
    method: 'get',
    headers: {
        isToken: false,
    },
  });
}

// 判断几何中心点位置是否在某两个桩号的面中间,有则返回桩号
export function isPointInBetweenStations(params: any) {
  return request({
    url: '/business/defect/isPointInBetweenStations',
    method: 'get',
    headers: {
        isToken: false,
    },
    params: params
  }); 
}

// 新增道路缺陷记录
export function addDefect(data: any) {
  return request({
    url: '/business/defect',
    method: 'post',
    headers: {
        isToken: false,
    },
    data: data
  }); 
}

// 修改道路缺陷记录
export function updateDefect(data: any) {
  return request({
    url: '/business/defect',
    method: 'put',
    headers: {
        isToken: false,
    },
    data: data
  });
}

// 删除道路缺陷记录
export function deleteDefect(id: string) {
  return request({
    url: '/business/defect/' + id,
    method: 'delete',
    headers: {
        isToken: false,
    },
  }) 
}

// 删除道路缺陷记录
export function defectImg(id: string) {
  return request({
    url: '/business/defectImg/' + id,
    method: 'delete',
    headers: {
        isToken: false,
    },
  }) 
}

// 删除道路缺陷记录
export function getExport(id: string) {
  return request({
    url: '/business/image/export' + id,
    method: 'post',
    headers: {
        isToken: false,
    },
  }) 
}

/**
 * 根据用户名查询用户列表
 * @param imageId
 */
export const getUserList = (params: any) => {
  return request({
    url: '/business/image/getUserList',
    method: 'get',
    headers: {
        isToken: false,
    },
    params: {
      userName: params
    }
  });
};
